import { Request, Response } from 'express';
const DICT_TYPE_BRAND: string = 'brand'; // 品牌
const DICT_TYPE_UNITNAME: string = 'unitName'; // 单位名称

const dataSourceMap = {
  [DICT_TYPE_BRAND]: [
    {
      createBy: 'admin', // 创建者
      createTime: '2019-11-29', // 创建时间
      cssClass: 'string', // 字典样式
      dictCode: 1, // 字典编码（修改必传）
      dictLabel: '品牌1', // 字典标签
      dictSort: 0, // 字典排序
      dictType: 'string', // 字典类型
      dictValue: '1234', // 字典键值
      isDefault: 0, // 是否默认（0：不默认，1：默认）
      listClass: 'string', // 回显样式
      remark: '测试备注', // 备注
      status: 0, // 状态（0正常 1禁用）
      updateBy: 'admin', // 更新者
      updateTime: '2019-11-29', // 更新时间
    },
    {
      createBy: 'admin', // 创建者
      createTime: '2019-11-29', // 创建时间
      cssClass: 'string', // 字典样式
      dictCode: 1, // 字典编码（修改必传）
      dictLabel: '品牌2', // 字典标签
      dictSort: 0, // 字典排序
      dictType: 'string', // 字典类型
      dictValue: '3245', // 字典键值
      isDefault: 0, // 是否默认（0：不默认，1：默认）
      listClass: 'string', // 回显样式
      remark: '测试备注', // 备注
      status: 0, // 状态（0正常 1禁用）
      updateBy: 'admin', // 更新者
      updateTime: '2019-11-29', // 更新时间
    },
  ],
  [DICT_TYPE_UNITNAME]: [
    {
      createBy: 'admin', // 创建者
      createTime: '2019-11-29', // 创建时间
      cssClass: 'string', // 字典样式
      dictCode: 1, // 字典编码（修改必传）
      dictLabel: '单位1', // 字典标签
      dictSort: 0, // 字典排序
      dictType: 'string', // 字典类型
      dictValue: 123, // 字典键值
      isDefault: 0, // 是否默认（0：不默认，1：默认）
      listClass: 'string', // 回显样式
      remark: '测试备注', // 备注
      status: 0, // 状态（0正常 1禁用）
      updateBy: 'admin', // 更新者
      updateTime: '2019-11-29', // 更新时间
    },
    {
      createBy: 'admin', // 创建者
      createTime: '2019-11-29', // 创建时间
      cssClass: 'string', // 字典样式
      dictCode: 1, // 字典编码（修改必传）
      dictLabel: '单位2', // 字典标签
      dictSort: 0, // 字典排序
      dictType: 'string', // 字典类型
      dictValue: 456, // 字典键值
      isDefault: 0, // 是否默认（0：不默认，1：默认）
      listClass: 'string', // 回显样式
      remark: '测试备注', // 备注
      status: 0, // 状态（0正常 1禁用）
      updateBy: 'admin', // 更新者
      updateTime: '2019-11-29', // 更新时间
    },
  ],
};

export default {
  'GET /v1/dictionaries/dictData/selectByDictType': (req: Request, res: Response) => {
    const { dictType } = req.query;
    setTimeout(() => {
      res.send({
        code: '0',
        data: dataSourceMap[dictType],
      });
    }, 1000);
  },

  'GET /v1/api/dept/SysDept/treeData': (req: Request, res: Response) => {
    setTimeout(() => {
      res.send({
        msg: '操作成功',
        code: '0',
        data: [
          {
            sdtDeptId: 5,
            sdtDeptPid: 0,
            sdtDeptAncestors: '0',
            sdtDeptName: '湖南总公司',
            sdtOrderNum: 0,
            sdtLeader: '若依湖南',
            sdtPhone: '15711681693',
            sdtEmail: '17722167@qq.com',
            sdtStatus: '0',
            sdtDelFlag: '0',
            sdtCreateBy: 'admin_test',
            sdtCreateTime: '2019-09-04 16:41:46',
            sdtUpdateBy: null,
            sdtUpdateTime: null,
            sdtParentName: null,
            children: [
              {
                sdtDeptId: 43,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: '邵阳公司',
                sdtOrderNum: 0,
                sdtLeader: '刘总',
                sdtPhone: '15698569856',
                sdtEmail: '12345678@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-09-18 17:48:12',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [
                  {
                    sdtDeptId: 87,
                    sdtDeptPid: 43,
                    sdtDeptAncestors: '0,5,43',
                    sdtDeptName: '师大',
                    sdtOrderNum: 5,
                    sdtLeader: '安总',
                    sdtPhone: '18392653945',
                    sdtEmail: '354645448@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-09-29 11:33:28',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: null,
                  },
                ],
              },
              {
                sdtDeptId: 9,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: '岳阳公司',
                sdtOrderNum: 1,
                sdtLeader: '岳阳老总',
                sdtPhone: '13111111111',
                sdtEmail: '1772121@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin_test',
                sdtCreateTime: '2019-09-04 17:26:29',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [
                  {
                    sdtDeptId: 62,
                    sdtDeptPid: 9,
                    sdtDeptAncestors: '0,5,9',
                    sdtDeptName: '雨花政府',
                    sdtOrderNum: 0,
                    sdtLeader: '宇总',
                    sdtPhone: '13895689658',
                    sdtEmail: '12568956@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-09-19 22:12:59',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: null,
                  },
                ],
              },
              {
                sdtDeptId: 8,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: '长沙公司',
                sdtOrderNum: 2,
                sdtLeader: '长沙老总',
                sdtPhone: '13111111111',
                sdtEmail: '1772121@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin_test',
                sdtCreateTime: '2019-09-04 17:26:01',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [
                  {
                    sdtDeptId: 49,
                    sdtDeptPid: 8,
                    sdtDeptAncestors: '0,5,8',
                    sdtDeptName: '岳麓区公司',
                    sdtOrderNum: 0,
                    sdtLeader: '谢总',
                    sdtPhone: '12345678968',
                    sdtEmail: '1257256985@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-09-19 12:04:44',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: null,
                  },
                ],
              },
              {
                sdtDeptId: 121,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: '衡阳分公司',
                sdtOrderNum: 9,
                sdtLeader: '李浩',
                sdtPhone: '18015985691',
                sdtEmail: '17015985691@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-15 15:46:21',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [
                  {
                    sdtDeptId: 123,
                    sdtDeptPid: 121,
                    sdtDeptAncestors: '0,5,121',
                    sdtDeptName: '石鼓区分管',
                    sdtOrderNum: 2,
                    sdtLeader: '警员2',
                    sdtPhone: '18659236589',
                    sdtEmail: '18659236589@qq.com',
                    sdtStatus: '1',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-15 15:50:38',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: [
                      {
                        sdtDeptId: 129,
                        sdtDeptPid: 123,
                        sdtDeptAncestors: '0,5,121,123',
                        sdtDeptName: '西苑',
                        sdtOrderNum: 1,
                        sdtLeader: '警员005 ',
                        sdtPhone: '13556236589',
                        sdtEmail: '13556236589@qq.com',
                        sdtStatus: '0',
                        sdtDelFlag: '0',
                        sdtCreateBy: 'admin',
                        sdtCreateTime: '2019-11-15 16:46:42',
                        sdtUpdateBy: null,
                        sdtUpdateTime: null,
                        sdtParentName: null,
                        children: null,
                      },
                    ],
                  },
                  {
                    sdtDeptId: 125,
                    sdtDeptPid: 121,
                    sdtDeptAncestors: '0,5,121',
                    sdtDeptName: '衡山县分管',
                    sdtOrderNum: 4,
                    sdtLeader: '警员4',
                    sdtPhone: '17556235896',
                    sdtEmail: '17556235896@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-15 15:56:51',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: [],
                  },
                  {
                    sdtDeptId: 122,
                    sdtDeptPid: 121,
                    sdtDeptAncestors: '0,5,121',
                    sdtDeptName: '珠晖区分管',
                    sdtOrderNum: 5,
                    sdtLeader: '警员1',
                    sdtPhone: '18956233652',
                    sdtEmail: '18956233652@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-15 15:50:05',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: [],
                  },
                  {
                    sdtDeptId: 126,
                    sdtDeptPid: 121,
                    sdtDeptAncestors: '0,5,121',
                    sdtDeptName: '耒阳市分管',
                    sdtOrderNum: 5,
                    sdtLeader: '警员5',
                    sdtPhone: '13622125689',
                    sdtEmail: '13622125689@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-15 15:57:26',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: [],
                  },
                ],
              },
              {
                sdtDeptId: 102,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: '按时公司',
                sdtOrderNum: 14,
                sdtLeader: '于总',
                sdtPhone: '13467937725',
                sdtEmail: '345189789@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-10-18 10:44:51',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [],
              },
              {
                sdtDeptId: 130,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: 'wangxi',
                sdtOrderNum: 22,
                sdtLeader: '王曦',
                sdtPhone: '15222222222',
                sdtEmail: 'ddd@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-15 17:03:21',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [],
              },
              {
                sdtDeptId: 101,
                sdtDeptPid: 5,
                sdtDeptAncestors: '0,5',
                sdtDeptName: '湘潭公司',
                sdtOrderNum: 125,
                sdtLeader: '安师大',
                sdtPhone: '18390259468',
                sdtEmail: '1568975468@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-10-18 10:38:21',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [],
              },
            ],
          },
          {
            sdtDeptId: 133,
            sdtDeptPid: 0,
            sdtDeptAncestors: '0',
            sdtDeptName: 'department',
            sdtOrderNum: 6,
            sdtLeader: 'meee',
            sdtPhone: '19900295468',
            sdtEmail: '11@qq.com',
            sdtStatus: '0',
            sdtDelFlag: '0',
            sdtCreateBy: 'admin',
            sdtCreateTime: '2019-11-16 17:13:23',
            sdtUpdateBy: null,
            sdtUpdateTime: null,
            sdtParentName: null,
            children: [
              {
                sdtDeptId: 134,
                sdtDeptPid: 133,
                sdtDeptAncestors: '0,133',
                sdtDeptName: 'hello',
                sdtOrderNum: 1,
                sdtLeader: 'meeec',
                sdtPhone: '16023456871',
                sdtEmail: '99@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-16 17:21:13',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: null,
              },
            ],
          },
          {
            sdtDeptId: 41,
            sdtDeptPid: 0,
            sdtDeptAncestors: '1',
            sdtDeptName: '前端部门',
            sdtOrderNum: 9,
            sdtLeader: '张总',
            sdtPhone: '13965896589',
            sdtEmail: '123698569@qq.com',
            sdtStatus: '0',
            sdtDelFlag: '0',
            sdtCreateBy: 'admin',
            sdtCreateTime: '2019-09-18 17:38:57',
            sdtUpdateBy: null,
            sdtUpdateTime: null,
            sdtParentName: null,
            children: [
              {
                sdtDeptId: 136,
                sdtDeptPid: 41,
                sdtDeptAncestors: '1,41',
                sdtDeptName: '前端2',
                sdtOrderNum: 1,
                sdtLeader: '李浩',
                sdtPhone: '19689563256',
                sdtEmail: '19689563256@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-18 10:51:38',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [
                  {
                    sdtDeptId: 138,
                    sdtDeptPid: 136,
                    sdtDeptAncestors: '1,41,136',
                    sdtDeptName: '前端22',
                    sdtOrderNum: 29,
                    sdtLeader: '李昊',
                    sdtPhone: '13256236958',
                    sdtEmail: '13256236958@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-18 10:57:23',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: null,
                  },
                  {
                    sdtDeptId: 137,
                    sdtDeptPid: 136,
                    sdtDeptAncestors: '1,41,136',
                    sdtDeptName: '前端21',
                    sdtOrderNum: 100,
                    sdtLeader: '李昊',
                    sdtPhone: '19623569875',
                    sdtEmail: '13623569875@qq.com',
                    sdtStatus: '0',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-18 10:52:44',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: null,
                  },
                ],
              },
              {
                sdtDeptId: 132,
                sdtDeptPid: 41,
                sdtDeptAncestors: '1,41',
                sdtDeptName: '123',
                sdtOrderNum: 123,
                sdtLeader: '123',
                sdtPhone: '15200291371',
                sdtEmail: 'safd@qq.com',
                sdtStatus: '1',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-15 17:35:38',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [],
              },
              {
                sdtDeptId: 135,
                sdtDeptPid: 41,
                sdtDeptAncestors: '1,41',
                sdtDeptName: '前端1',
                sdtOrderNum: 124,
                sdtLeader: '李浩',
                sdtPhone: '16245623219',
                sdtEmail: '16245623219@QQ.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-18 10:50:40',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [],
              },
            ],
          },
          {
            sdtDeptId: 139,
            sdtDeptPid: 0,
            sdtDeptAncestors: '0',
            sdtDeptName: '岳阳',
            sdtOrderNum: 10,
            sdtLeader: '张三',
            sdtPhone: '16995685213',
            sdtEmail: '16995685213@qq.com',
            sdtStatus: '0',
            sdtDelFlag: '0',
            sdtCreateBy: 'admin',
            sdtCreateTime: '2019-11-18 11:29:15',
            sdtUpdateBy: null,
            sdtUpdateTime: null,
            sdtParentName: null,
            children: [
              {
                sdtDeptId: 140,
                sdtDeptPid: 139,
                sdtDeptAncestors: '0,139',
                sdtDeptName: '平江',
                sdtOrderNum: 1,
                sdtLeader: 'zhouwu',
                sdtPhone: '13256329856',
                sdtEmail: '13256329856@qq.com',
                sdtStatus: '0',
                sdtDelFlag: '0',
                sdtCreateBy: 'admin',
                sdtCreateTime: '2019-11-18 11:30:08',
                sdtUpdateBy: null,
                sdtUpdateTime: null,
                sdtParentName: null,
                children: [
                  {
                    sdtDeptId: 142,
                    sdtDeptPid: 140,
                    sdtDeptAncestors: '0,139,140',
                    sdtDeptName: 'pingjiang2',
                    sdtOrderNum: 1,
                    sdtLeader: '周芳',
                    sdtPhone: '15623157896',
                    sdtEmail: '15623157896@qq.com',
                    sdtStatus: '1',
                    sdtDelFlag: '0',
                    sdtCreateBy: 'admin',
                    sdtCreateTime: '2019-11-18 11:40:28',
                    sdtUpdateBy: null,
                    sdtUpdateTime: null,
                    sdtParentName: null,
                    children: null,
                  },
                ],
              },
            ],
          },
        ],
      });
    }, 1000);
  },

  // 关联设备
  'GET /v1/device/treeType/selectByParent': (req: Request, res: Response) => {
    setTimeout(() => {
      res.send({
        code: '0',
        data: [
          {
            treeTypeId: 1,
            treeName: '食堂',
          },
          {
            treeTypeId: 2,
            treeName: '一楼',
          },
        ],
      });
    }, 100);
  },
};
